import request from '@/utils/request'
import { download } from '@/utils/request'

// 新增优惠券
export function addCoupon(data) {
  return request({
    url: '/businessCore/faCoupon',
    method: 'post',
    data
  })
}

// 修改优惠券
export function updateCoupon(data) {
  return request({
    url: '/businessCore/faCoupon',
    method: 'put',
    data
  })
}

// 删除优惠券
export function delCoupon(id) {
  return request({
    url: '/businessCore/faCoupon/' + id,
    method: 'delete'
  })
}

// 导出优惠券
export function exportCoupon(params, fileName) {
  const url = '/businessCore/faCoupon/export'
  download(
    url,
    params,
    fileName + `_${new Date().getTime()}.xlsx`
  )
}